package com.servicesManagement.model;
// Generated Dec 13, 2014 11:53:18 AM by Hibernate Tools 3.2.1.GA

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * AspectConf generated by hbm2java
 */
@Entity
@Table(name = "ASPECT_CONF", schema = "SANKAR")
public class AspectConf implements java.io.Serializable {

    private Long aspectConfId;
    @JsonIgnore
    private Attribute attribute;
    private Aspect aspect;
    private BigDecimal changedByUserId;
    private Date changedDate;
    private BigDecimal createdByUserId;
    private Date createdDate;
    private String defaultValue;
    private BigDecimal displayOrder;
    private String readOnly;
    private String required;
    
    private AspectListGroup aspectListGroup;
    @JsonIgnore
    private List<AspectListGroupConf> aspectListGroupConfs = new ArrayList<AspectListGroupConf>();

    public AspectConf() {
    }

    public AspectConf(Long aspectConfId) {
        this.aspectConfId = aspectConfId;
    }

    public AspectConf(Long aspectConfId, Attribute attribute, Aspect aspect, BigDecimal changedByUserId, Date changedDate, BigDecimal createdByUserId, Date createdDate, String defaultValue, BigDecimal displayOrder, String readOnly, String required, Set aspectConfGroups, Set participationAspects, Set aspectConfGroupConfs, Set aspectListGroups) {
        this.aspectConfId = aspectConfId;
        this.attribute = attribute;
        this.aspect = aspect;
        this.changedByUserId = changedByUserId;
        this.changedDate = changedDate;
        this.createdByUserId = createdByUserId;
        this.createdDate = createdDate;
        this.defaultValue = defaultValue;
        this.displayOrder = displayOrder;
        this.readOnly = readOnly;
        this.required = required;

    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ASPECT_CONF_ID", unique = true, nullable = false, scale = 0)
    public Long getAspectConfId() {
        return this.aspectConfId;
    }

    public void setAspectConfId(Long aspectConfId) {
        this.aspectConfId = aspectConfId;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade= CascadeType.ALL)
    @JoinColumn(name = "ATTRIBUTE_ID")
    public Attribute getAttribute() {
        return this.attribute;
    }

    public void setAttribute(Attribute attribute) {
        this.attribute = attribute;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
    @JoinColumn(name = "ASPECT_ID")
    public Aspect getAspect() {
        return this.aspect;
    }

    public void setAspect(Aspect aspect) {
        this.aspect = aspect;
    }

    @Column(name = "CHANGED_BY_USER_ID")
    public BigDecimal getChangedByUserId() {
        return this.changedByUserId;
    }

    public void setChangedByUserId(BigDecimal changedByUserId) {
        this.changedByUserId = changedByUserId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CHANGED_DATE", length = 7)
    public Date getChangedDate() {
        return this.changedDate;
    }

    public void setChangedDate(Date changedDate) {
        this.changedDate = changedDate;
    }

    @Column(name = "CREATED_BY_USER_ID")
    public BigDecimal getCreatedByUserId() {
        return this.createdByUserId;
    }

    public void setCreatedByUserId(BigDecimal createdByUserId) {
        this.createdByUserId = createdByUserId;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CREATED_DATE", length = 7)
    public Date getCreatedDate() {
        return this.createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    @Column(name = "DEFAULT_VALUE")
    public String getDefaultValue() {
        return this.defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    @Column(name = "DISPLAY_ORDER")
    public BigDecimal getDisplayOrder() {
        return this.displayOrder;
    }

    public void setDisplayOrder(BigDecimal displayOrder) {
        this.displayOrder = displayOrder;
    }

    @Column(name = "READ_ONLY")
    public String getReadOnly() {
        return this.readOnly;
    }

    public void setReadOnly(String readOnly) {
        this.readOnly = readOnly;
    }

    @Column(name = "REQUIRED")
    public String getRequired() {
        return this.required;
    }

    public void setRequired(String required) {
        this.required = required;
    }

    @OneToOne(fetch = FetchType.LAZY, mappedBy = "aspectConf")
    public AspectListGroup getAspectListGroup() {
        return aspectListGroup;
    }

    public void setAspectListGroup(AspectListGroup aspectListGroup) {
        this.aspectListGroup = aspectListGroup;
    }

  /*  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "id.aspectListGroup.aspectConf")
    public List<AspectListGroupConf> getAspectListGroupConfs() {

     /*   List<AspectListGroupConf> returnAspectListGroupConfs = null;
        if (this.aspectListGroupConfs == null) {

            //returnAspectListGroupConfs = getAspectListGroup() != null ? getAspectListGroup().getAspectListGroupConfs() : null;
        } else {

            returnAspectListGroupConfs = this.aspectListGroupConfs;
        }

        return returnAspectListGroupConfs;       
        return this.aspectListGroupConfs;
    }

    public void setAspectListGroupConfs(List<AspectListGroupConf> aspectListGroupConfs) {
        this.aspectListGroupConfs = aspectListGroupConfs;
    }
*/

    @Override
    public String toString() {
        return "AspectConf{" + "aspectConfId=" + aspectConfId + ", changedByUserId=" + changedByUserId + ", changedDate=" + changedDate + ", createdByUserId=" + createdByUserId + ", createdDate=" + createdDate + ", defaultValue=" + defaultValue + ", displayOrder=" + displayOrder + ", readOnly=" + readOnly + ", required=" + required + ", aspectListGroup=" + aspectListGroup + '}';
    }
  
}
